package com.rkhd.xsy;

import com.rkhd.login.ConfigurationFile;

import java.util.HashMap;

/**
 * 公共变量的封装类操作
 */
public class MsgQueue {
    //  staging 环境租户名称
    /**
     * STAGING_USERNAME  : staging 环境 : username
     * msgQueue          : msgQueue : 队列
     * STAGING_TENANTID  : 默认 租户id 配置
     */

    private static final String STAGING_USERNAME = ConfigurationFile.readCfgValue("staging", "username");

    private static MsgQueue msgQueue = null;

    private static final String STAGING_TENANTID = ConfigurationFile.readCfgValue("staging", "tenantId");

    private MsgQueue() {
    }

    ;

    public static final String getTenantName() {
        String username = null;
        if (STAGING_USERNAME.equals("")) {
            /**
             *  判断如何 STAGING_USERNAME 对象为空 ; 则抛出空指针异常 ;
             */
            throw new NullPointerException("STAGING_USERNAME IS NULL");
        }

        return STAGING_USERNAME;
    }


    public static MsgQueue getMsgQueueInstance() {

        if (msgQueue == null) {

            msgQueue = new MsgQueue();
        }

        return msgQueue;
    }

    /**
     * 设置 staging 环境 属性变量
     */

    public static HashMap<String, Object> getStagingParameter() {

        //  staging 环境租户密码
        final String STAGING_PASSWORD = "111111";
        //   staging获取 租户id


        HashMap<String, Object> logFormDataMap = new HashMap<>();
        logFormDataMap.put("loginName", STAGING_USERNAME);
        logFormDataMap.put("password", STAGING_PASSWORD);
        logFormDataMap.put("pcCodeForFocusMedia", String.valueOf(0));
        logFormDataMap.put("fromOther", "");
        ;
        logFormDataMap.put("thirdPartyType", "");
        logFormDataMap.put("client_id", "");
        logFormDataMap.put("response_type", "");
        logFormDataMap.put("redirect_uri", "");


        return logFormDataMap;

    }


    public static String getStagingTenantid() {


        return STAGING_TENANTID;

    }


}
